<ui:composition template="template.xhtml"
                xmlns="http://www.w3.org/1999/xhtml"
                xmlns:p="http://primefaces.org/ui"
                xmlns:f="http://java.sun.com/jsf/core"
                xmlns:h="http://java.sun.com/jsf/html"
                xmlns:ui="http://java.sun.com/jsf/facelets">  


    <ui:define name="menuEsquerdo"></ui:define>
    <ui:define name="menuDireito">
        <h:form id="form">
            <p:dataTable var="professor" value="#{tableBean.professores}" rowKey="#{professor.nome}" paginator="true" rows="3"
                          selection="#{tableBean.selectedProfessor}" selectionMode="single" id="profTable">



                <f:facet name="header">
                    Lista de Professores
                </f:facet>

                <p:column headerText="Nome" sortBy="#{professor.nome}" filterBy="#{professor.nome}" id="nome">
                    #{professor.nome}
                </p:column>

                <p:column headerText="Data de Admissão" sortBy="#{professor.admissao}" filterBy="#{professor.admissao}" id="year">
                    #{professor.admissao}
                </p:column>

                <p:column headerText="Titulo" sortBy="#{professor.titulo}" filterBy="#{professor.titulo}" id="manufacturer">
                    #{professor.titulo}
                </p:column>

                <p:column headerText="Titulo de novo" sortBy="#{professor.titulo}" filterBy="#{professor.titulo}" id="color">
                    #{professor.titulo}"
                </p:column>

              
                <f:facet name="footer">
                    <p:commandButton id="viewButton" value="Visualizar" icon="ui-icon-search"
                                     update=":form:display" oncomplete="carDialog.show()"/>
                </f:facet>
                   
                <f:facet name="footer">
                    <p:commandButton id="deleteButton" value="Excluir" icon="ui-icon-trash"
                                     update=":form:display" oncomplete="carDialog.show()"/>
                </f:facet>
            </p:dataTable>

            <p:dialog header="Informações do Professor" widgetVar="carDialog" resizable="false"
                      width="600" showEffect="explode" hideEffect="explode">

                <h:panelGrid id="display" columns="2" cellpadding="4">

                    <h:outputText value="Nome:" />
                    <h:outputText value="#{tableBean.selectedProfessor.nome}" id="model"/>

                    <h:outputText value="Data de admissão:" />
                    <h:outputText value="#{tableBean.selectedProfessor.admissao}" id="year"/>

                    <h:outputText value="Titulo:" />
                    <h:outputText value="#{tableBean.selectedProfessor.titulo}" id="manufacturer"/>

                    <h:outputText value="Color:" />
                    <h:outputText value="#{tableBean.selectedProfessor.nome}" id="color"/>
                    
                    <h:commandLink action="editarProfessor.xhtml" value="Editar cadastro"></h:commandLink>
                </h:panelGrid>
            </p:dialog>

        </h:form>
    </ui:define>

</ui:composition>

